 
<!--
 * @Author: CHINAKAIYUAN<sunkaiyuan@namenode.cn>
 * @Date: 2022-02-03 14:41:20
 * @LastEditTime: 2023-07-24 14:27:48
 * @LastEditors: 孙开源 && sunkaiyuan@namenode.cn
 * @Description:   :gridOps="gridOptions" allocation
-->
<template>
  <sc-VxeTable ref="xGrid" :tablecode="'pro_color_detail'" :url="api.pro.color.details" :gridEvts="gridEvents">
  </sc-VxeTable>
  <auditGood v-if="dialog.auditGood" ref="refauditGood" @success="handleSuccess" @closed="dialog.auditGood = false">
  </auditGood>
  <fauditDialog v-if="dialog.faudit" ref="reffaudit" @success="handleSuccess" @closed="dialog.faudit = false">
  </fauditDialog>
</template>
<script>
export default {
  name: "pro_color_details",
};
</script>
<script setup>
import { ref, nextTick } from "vue";
import fauditDialog from "./faudit";
import auditGood from "./auditGood";

import api from "@/api";


const refauditGood = ref({});
const reffaudit = ref({});
const xGrid = ref({});

const dialog = ref({
  auditGood: false,
  faudit: false,
});

const handleSuccess = () => {
  xGrid.value.refresh();
};


const gridEvents = {
  cellDblclick: function ({ row }) {
    gridEvents.auditGood(row);
  },
  auditGood: function (data) {
    dialog.value.auditGood = true;
    if (typeof data.$grid !== "undefined") {
      data = data.$grid.getCheckboxRecords()[0];
    }
    nextTick(() => {
      refauditGood.value.setData(data);
      refauditGood.value.open();
    });
  },
  faudit: function (data) {
    dialog.value.faudit = true;
    if (typeof data.$grid !== "undefined") {
      data = data.$grid.getCheckboxRecords()[0];
    }
    nextTick(() => {
      reffaudit.value.setData(data);
      reffaudit.value.open();
    });
  },
};
</script>
